package com.motorola.accessories;

import android.content.Context;
import android.preference.Preference;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class TittlePreference extends Preference {
    public final static int NO_INFO_TYPE = 0;
    public final static int HAS_INFO_TYPE = 1;
    public final static int DOCK_INFO_TYPE = 2;
    public final static int HEARDSET_INFO_TYPE = 3;

    private int mType = -1;

    public TittlePreference(Context context, int type) {
        super(context);
        setSelectable(false);
        setPersistent(false);
        mType = type;
    }

    protected View onCreateView(ViewGroup parent) {
        View view = null;
        TextView textView = new TextView(getContext(), null, android.R.attr.listSeparatorTextViewStyle);
        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
        switch (mType) {
            case NO_INFO_TYPE:
                view = inflater.inflate( R.layout.no_info, null );
                break;
            case HAS_INFO_TYPE:
                view = inflater.inflate( R.layout.time_info, null );
                break;
            case DOCK_INFO_TYPE:
                textView.setText(getContext().getResources().getString(R.string.docks));
                view = textView;
                break;
            case HEARDSET_INFO_TYPE:
                textView.setText(getContext().getResources().getString(R.string.headsets));
                view = textView;
                break;
            default:
                break;
        }
        return view;
    }
}
